from libs.pyqt5braisedpork.errorMap import Code, CodeMap


def json_response(code=Code.OK, message=CodeMap[Code.OK], data=None, **kwargs):
    """json 序列化返回"""

    temp = {
        "code": code,
        "message": message,
        "data": data
    }

    if kwargs:
        temp.update(**kwargs)

    return temp
